import requests



class DepartmentManagementApi:

    #  http://ihrm2-test.itheima.net

    # 添加部门
    @classmethod
    def department_add(cls, token):
        url ="http://ihrm2-test.itheima.net/api/company/department"
        head = {"Content-Type":"application/json", "Authorization":token}
        body = {"name":"啊啊啊啊", "code":"96513265615845"}
        resp = requests.post(url, headers=head, json=body)
        return resp

    # 修改部门
    @classmethod
    def department_put(cls, depaId, token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+depaId
        head = {"Content-Type":"application/json", "Authorization":token}
        body = {"name":"哦哦哦哦哦", "code":"9651312152845"}
        rsap = requests.put(url, headers=head, json=body)
        return rsap

    # 查询部门
    @classmethod
    def department_query(cls,depaId, token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+depaId
        head = {"Authorization":token}
        resp = requests.get(url, headers=head)
        return resp

    # 删除部门
    @classmethod
    def department_delete(cls, depaId, token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+depaId
        head = {"Authorization":token}
        resp = requests.get(url, headers=head)
        return resp





# if __name__ == '__main__':
#     resp = DepartmentManagementApi.department_add("eacd0c2f-0830-48b2-8081-945c020f0cc0")
#     print(resp.json())